package cn.iocoder.yudao.module.exam.dal.mysql.studentpaper;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.exam.dal.dataobject.studentpaper.StudentPaperDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.exam.controller.admin.studentpaper.vo.*;

/**
 * 试卷管理 Mapper
 *
 * @author Francis
 */
@Mapper
public interface StudentPaperMapper extends BaseMapperX<StudentPaperDO> {

    default PageResult<StudentPaperDO> selectPage(StudentPaperPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudentPaperDO>()
                .eqIfPresent(StudentPaperDO::getPaperCode, reqVO.getPaperCode())
                .eqIfPresent(StudentPaperDO::getExamId, reqVO.getExamId())
                .eqIfPresent(StudentPaperDO::getBatchId, reqVO.getBatchId())
                .likeIfPresent(StudentPaperDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(StudentPaperDO::getStudentNo, reqVO.getStudentNo())
                .eqIfPresent(StudentPaperDO::getExamNo, reqVO.getExamNo())
                .eqIfPresent(StudentPaperDO::getClassName, reqVO.getClassName())
                .eqIfPresent(StudentPaperDO::getTotalScore, reqVO.getTotalScore())
                .orderByDesc(StudentPaperDO::getId));
    }

}